<?php if(isset($items) && isset($order)): ?>
  <?php slot('documentType', 'Zamówienie') ?>
  <?php slot('documentTitle', $order->getNumber()) ?>
  <?php slot('documentAnnotation', $order->getDemand()->getDescription()) ?>
  <?php slot('documentAuthorName', $order->getUser()) ?>
  <?php slot('documentAuthorEmail', $order->getUser()->getEmail()) ?>
  <?php slot('documentAuthorNumber', $order->getUser()->getNumber()) ?>
  <?php slot('documentAuthorMobile', $order->getUser()->getMobile()) ?>
  <?php slot('companyName', $companyName) ?>
  <?php slot('companyAddress', $companyAddress) ?>
  <?php slot('documentExtraRows') ?>
  <tr>
    <td id="title" style="padding: 4px;background-color: #DDDDDD; text-align: right; font-weight: bold;">Adres dostawy</td>
    <td colspan="3" style="padding: 4px;text-align: center;"><?php echo $order->getTargetAddress() ?></td>
  </tr>
  <tr>
    <td id="header" colspan="4" style="padding: 4px; background-color: #AAAAAA; font-size: 11pt; font-weight: bold; text-align: center;">Dostarczający</td>
  </tr>
  <tr>
    <td id="title" style="padding: 4px;background-color: #DDDDDD; text-align: right; font-weight: bold;">Firma</td>
    <td style="padding: 4px;text-align: center;"><?php echo $order->getDeliverer()->getName().", ul. ".$order->getDeliverer()->getAddress()->getStreet().", ".$order->getDeliverer()->getAddress()->getCity() ?></td>
    <td id="title" style="padding: 4px;background-color: #DDDDDD; text-align: right; font-weight: bold;">Tel.</td>
    <td style="padding: 4px;text-align: center;"><?php echo $order->getDeliverer()->getTelephone() ?></td>
  </tr>
  <tr>
    <td id="title" style="padding: 4px;background-color: #DDDDDD; text-align: right; font-weight: bold;">Osoba</td>
    <td style="padding: 4px;text-align: center;"><?php echo $order->getDeliverer()->getPerson() ?></td>
    <td id="title" style="padding: 4px;background-color: #DDDDDD; text-align: right; font-weight: bold;">Email</td>
    <td style="padding: 4px;text-align: center;"><?php echo $order->getDeliverer()->getEmail() ?></td>
  </tr>
  <?php end_slot() ?>
<?php $counter = 1; ?>
  <?php slot('documentItemsRows') ?>
    <tr>
      <td id="small_header" width="30" style="padding: 4px; background-color: #AAAAAA; font-size: 10.5pt; font-weight: bold; text-align: center;">Lp</td>
      <td id="small_header" width="250" style="padding: 4px; background-color: #AAAAAA; font-size: 10.5pt; font-weight: bold; text-align: center;">Nazwa</td>
      <td id="small_header" style="padding: 4px; background-color: #AAAAAA; font-size: 10.5pt; font-weight: bold; text-align: center;">Symbol</td>
      <td id="small_header" style="padding: 4px; background-color: #AAAAAA; font-size: 10.5pt; font-weight: bold; text-align: center;">Zamówiono</td>
      <td id="small_header" style="padding: 4px; background-color: #AAAAAA; font-size: 10.5pt; font-weight: bold; text-align: center;">Dostarczono</td>
      <td id="small_header" style="padding: 4px; background-color: #AAAAAA; font-size: 10.5pt; font-weight: bold; text-align: center;">J.m.</td>
      <td id="small_header" width="190" style="padding: 4px; background-color: #AAAAAA; font-size: 10.5pt; font-weight: bold; text-align: center;">Uwagi</td>
    </tr>
    <?php foreach($items as $item): ?>
    <tr>
      <td style="padding: 4px;text-align: center;"><?php echo $counter++; ?></td>
      <td style="padding: 4px;"><?php echo $item['name'] ?></td>
      <td style="padding: 4px;text-align: center;"><?php echo ($item['symbol'] !== "NULL" && !is_null($item['symbol'])) ? $item['symbol']  : '-'  ?></td>
      <td style="padding: 4px;text-align: center;"><?php echo $item['ordered_value']  ?></td>
      <td style="padding: 4px;text-align: center;"><?php echo $item['supplied_value'] ? : 0  ?></td>
      <td style="padding: 4px;text-align: center;"><?php echo $item['quantityUnit']  ?></td>
      <td style="padding: 4px;text-align: center;"><?php echo $item['annotation']  ?></td>
    </tr>
    <?php endforeach; ?>
  <?php end_slot() ?>
<?php else: ?>
    <?php slot('documentError', 'Brak dokumentu.') ?>
<?php endif; ?>

